import axiosHttp from '@/libs/request';
import { UserInfo } from '@/model';

/**
 * 获取sso-server认证中心地址，然后重定向到该地址
 * @param clientLoginUrl 当前客户端的登录地址
 */
export const getSsoAuthUrl = (clientLoginUrl: string) => {
  return axiosHttp.get<any>('/admin/sso/getSsoAuthUrl', { clientLoginUrl });
};

/**
 * 验票
 * @param ticket 票据
 */
export const loginByTicket = (ticket: string) => {
  return axiosHttp.get<UserInfo>('/admin/sso/doLoginByTicket', { ticket });
};

/**
 * 单点退出
 */
export const logout = () => {
  return axiosHttp.get('/admin/sso/logout');
};
